package com.yln.watcher.client;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

public class WorkerContext implements ZkContext {
    // 保存当前被分配了的任务
    private List<String> assignedTasks = new ArrayList<>();

    @Override
    public void cacheWorkers(List<String> allWorkers) {

    }

    @Override
    public void cacheTasks(List<String> tasks) {

    }

    @Override
    public List<String> getHasProceededTasks() {
        return assignedTasks;
    }

    @Override
    public void taskProcessing(String task) {
        assignedTasks.add(task);
    }

    @Override
    public void addNotAssignedTasks(List<String> taskNodes) {

    }

    @Override
    public Optional<String> randomWorker() {
        throw new RuntimeException("Worker node not support random worker.");
    }

    @Override
    public List<String> getAllWorkers() {
        throw new RuntimeException("Worker node not support get all workers.");
    }

    @Override
    public List<String> getAllTasks() {
        throw new RuntimeException("Worker node not support get all tasks.");
    }

    @Override
    public void removeTask(String task) {
        throw new RuntimeException("Worker node not support remove task.");
    }
}
